package com.vains.controller;

import com.vains.bean.Result;
import com.vains.entity.OauthUser;
import com.vains.service.IOauthUserService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 用户接口
 *
 * @author vains
 * @date 2021/4/10 12:38
 */
@RestController
@AllArgsConstructor
@Api(tags = "用户接口")
@RequestMapping("/user")
public class OauthUserController {

    private final IOauthUserService iOauthUserService;

    @GetMapping("/loadUserByUsername/{username}")
    @ApiParam(name = "username", value = "手机号/账号")
    @ApiOperation(value = "根据手机号/账号查询用户", hidden = true)
    public Result<OauthUser> loadUserByUsername(@PathVariable String username) {
        OauthUser oauthUser = iOauthUserService.loadUserByUsername(username);
        return Result.success(oauthUser);
    }

}
